fn main() {
    let re = Rect {
        width: 10,
        length: 20,
    };
    println!("{:#?}", re);
    let re2 = Rect::square(30);
    let re3 = Rect::square2(23);
    println!("{}", re.area());
    println!("{}", re.get_width());
    println!("{}", re2.area());
    println!("{}", re3)
}
impl Rect {
    fn area(&self) -> i32 {
        self.length * self.width
    }
}
impl Rect {
    fn get_width(&self) -> i32 {
        self.width
    }
    fn square(size: i32) -> Rect {
        Rect {
            width: size,
            length: size,
        }
    }
    fn square2(size: i32) -> i32 {
        2*size
    }
    
}
#[derive(Debug)]
struct Rect {
    width: i32,
    length: i32,
}
